# server/apps/deep_model/models.py
from django.db import models
import os
from datetime import datetime

def upload_to_path(instance, filename):
    now = datetime.now()
    year = now.strftime('%Y')
    month = now.strftime('%m')
    return os.path.join('images', year, month, filename)

class ImageModel(models.Model):
    image = models.ImageField(upload_to=upload_to_path, verbose_name="存放位置")
    uploaded_at = models.DateTimeField(auto_now_add=True, verbose_name="上传时间")

    def __str__(self):
        return self.image.name

    class Meta:
        db_table = 'deep_image'
        verbose_name = 'Image'
        verbose_name_plural = verbose_name
